/*
 * @Author: 李石
 * @Date: 2024-07-16 09:53:34
 * @LastEditors: lishi
 * @LastEditTime: 2024-07-16 09:56:28
 * @Description: 
 * Copyright (c) 2024 by ${lishi0105@163.com}, All Rights Reserved. 
 */
#ifndef _NALU_DEBUG_H_
#define _NALU_DEBUG_HH_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include <time.h>
#include <sys/time.h>
#include "NaluParse.h"

#ifndef parse_info
#define parse_info(fmt, args...) do { \
    struct timeval ___tv___; \
    gettimeofday(&___tv___, NULL); \
    struct tm* __ptm___ = localtime(&___tv___.tv_sec); \
    char ___time_string__[40]; \
    strftime(___time_string__, sizeof(___time_string__), "%Y-%m-%d %H:%M:%S", __ptm___); \
    printf("\033[0;32m[%s.%03ld: %s:%d]: " fmt "\033[0m", ___time_string__, ___tv___.tv_usec / 1000, __FILE__, __LINE__, ##args); \
} while (0)
#endif

#ifndef parse_error
#define parse_error(fmt, args...) do { \
    struct timeval ___tv___; \
    gettimeofday(&___tv___, NULL); \
    struct tm* __ptm___ = localtime(&___tv___.tv_sec); \
    char ___time_string__[40]; \
    strftime(___time_string__, sizeof(___time_string__), "%Y-%m-%d %H:%M:%S", __ptm___); \
    printf("\033[0;31m[%s.%03ld: %s:%d]: " fmt "\033[0m", ___time_string__, ___tv___.tv_usec / 1000, __FILE__, __LINE__, ##args); \
} while (0)
#endif

void h264_debug_sps(sps_t* sps);
void h264_debug_pps(pps_t* pps);
void h264_debug_slice_header(h264_stream_t* h);
void h264_debug_aud(aud_t* aud);
void h264_debug_seis( h264_stream_t* h);

void h264_debug_nal(h264_stream_t* h, nal_t* nal);

void h265_debug_ptl(profile_tier_level_t* ptl, int profilePresentFlag, int max_sub_layers_minus1);
void h265_debug_sub_layer_hrd_parameters(sub_layer_hrd_parameters_t* subhrd, int sub_pic_hrd_params_present_flag, int CpbCnt, int subLayerId, const char* p);
void h265_debug_hrd_parameters(hrd_parameters_t* hrd, int commonInfPresentFlag, int maxNumSubLayersMinus1);
void h265_debug_vps(h265_vps_t* vps);
void h265_debug_scaling_list(scaling_list_data_t* sld);
void h265_debug_short_term_ref_pic_set(h265_sps_t* sps, st_ref_pic_set_t*st, referencePictureSets_t* rps, int stRpsIdx);
void h265_debug_vui_parameters(vui_parameters_t* vui, int maxNumSubLayersMinus1);
void h265_debug_sps(h265_sps_t* sps);
void h265_debug_pps(h265_pps_t* pps);
void h265_debug_aud(h265_aud_t* aud);
void h265_debug_seis(h265_stream_t* h);
void h265_debug_ref_pic_lists_modification(h265_slice_header_t* hrd);
void h265_debug_pred_weight_table(h265_stream_t* h);
void h265_debug_slice_header(h265_stream_t* h);

void h265_debug_nal(h265_stream_t* h, h265_nal_t* nal);

void h265_debug_nal_t(h265_stream_t* h, h265_nal_t* nal);

#ifdef __cplusplus
}
#endif
#endif // _NALU_DEBUG_HH_